package br.com.cartools.entity.so;

import java.util.List;

import br.com.cartools.entity.car.CarComponent;
import br.com.cartools.entity.customer.Customer;

public class ServiceOrder {

	private Integer id;
	private Customer customer;
	private String serviceOrderId;
	private List<CarComponent> components;
	
	public ServiceOrder(){
		
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public String getServiceOrderId() {
		return serviceOrderId;
	}

	public void setServiceOrderId(String serviceOrderId) {
		this.serviceOrderId = serviceOrderId;
	}

	public List<CarComponent> getComponents() {
		return components;
	}

	public void setComponents(List<CarComponent> components) {
		this.components = components;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((components == null) ? 0 : components.hashCode());
		result = prime * result
				+ ((customer == null) ? 0 : customer.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result
				+ ((serviceOrderId == null) ? 0 : serviceOrderId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ServiceOrder other = (ServiceOrder) obj;
		if (components == null) {
			if (other.components != null)
				return false;
		} else if (!components.equals(other.components))
			return false;
		if (customer == null) {
			if (other.customer != null)
				return false;
		} else if (!customer.equals(other.customer))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (serviceOrderId == null) {
			if (other.serviceOrderId != null)
				return false;
		} else if (!serviceOrderId.equals(other.serviceOrderId))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "ServiceOrder [id=" + id + ", customer=" + customer
				+ ", serviceOrderId=" + serviceOrderId + ", components="
				+ components + "]";
	}
	
}
